package com.app.ryjy.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 残疾等级枚举
 */
@AllArgsConstructor
@Getter
public enum DisabilityLevelEnum {
    // 伤残一级
    LEVEL_ONE("伤残一级", "01", -1),
    // 伤残二级
    LEVEL_TWO("伤残二级", "02", -1),
    // 伤残三级
    LEVEL_THREE("伤残三级", "03", -1),
    // 伤残四级
    LEVEL_FOUR("伤残四级", "04", -1),
    // 伤残五级
    LEVEL_FIVE("伤残五级", "05", -1),
    // 伤残六级
    LEVEL_SIX("伤残六级", "06", -1),
    // 伤残七级
    LEVEL_SEVEN("伤残七级", "07", -1),
    // 伤残八级
    LEVEL_EIGHT("伤残八级", "08", -1),
    // 伤残九级
    LEVEL_NINE("伤残九级", "09", -1),
    // 伤残十级
    LEVEL_TEN("伤残十级", "10", -1),
    // 未达等级
    NOT_REACHED("未达等级", "11", -1);

    private final String desc;
    private final String code;
    private final int bizCode;

    /**
     * 根据 bizCode 获取 code
     *
     * @param bizCode bizCode
     * @return code
     */
    public static String getCodeByBizCode(int bizCode) {
        for (DisabilityLevelEnum level : values()) {
            if (level.getBizCode() == bizCode) {
                return level.getCode();
            }
        }
        throw new RuntimeException("bizCode 不存在");
    }

    public static void main(String[] args) {
        System.out.println(DisabilityLevelEnum.getCodeByBizCode(1));
    }
}